//
//  RECWebViewController.m
//  CarFace
//
//  Created by dlios on 15/3/27.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "RECWebViewController.h"

@interface RECWebViewController ()

@end

@implementation RECWebViewController

- (void)dealloc
{
    [_idStr release];
    [super dealloc];
}



- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    
        
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 64)];
    [self.view addSubview:view];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    //    button.backgroundColor = [UIColor whiteColor];
    [button setTitle:@"<返回" forState:UIControlStateNormal];
    button.frame = CGRectMake(0, 22, self.view.frame.size.width / 5, 42);
    [button addTarget:self action:@selector(cliksssss:) forControlEvents:UIControlEventTouchUpInside];
    [view addSubview:button];
    
    UIWebView *webVC = [[UIWebView alloc] initWithFrame:CGRectMake(0, 64, self.view.frame.size.width, self.view.frame.size.height - 64)];
    //@"http://cont.app.autohome.com.cn/autov4.6/content/news/newscontent-n864676-t0.json";
    //http://cont.app.autohome.com.cn/autov4.6/content/news/newscontent-n865551-t0.json
    NSURL *url = [NSURL URLWithString:self.idStr];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [self.view addSubview:webVC];
    [webVC loadRequest:request];
    [webVC release];

}


//1.- (void )webViewDidStartLoad:(UIWebView  *)webView   网页开始加载的时候调用
//2.- (void )webViewDidFinishLoad:(UIWebView  *)webView  网页加载完成的时候调用
- (void)webView:(UIWebView *)webView  didFailLoadWithError:(NSError *)error
{
    NSLog(@"网页加载错误");
}
- (void)cliksssss:(UIButton *)button
{
    NSLog(@"5d");
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
     }

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
